package com.yuteng.user.controller;

import com.yuteng.comment.entity.Result;
import com.yuteng.comment.entity.VideoComment;
import com.yuteng.user.entity.VideoUser;
import com.yuteng.user.service.impl.VideoUserServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.yuteng.user.service.VideoUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统用户表（存放所有的管理员和用户信息）服务控制器
 *
 * @author 余腾
 * @description 用户喜欢的视频的一些信息
 * @since 2021-10-27 16:25:26
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/videoUser")
public class VideoUserController {
    private final VideoUserService videoUserService;
    @Autowired
    VideoUserServiceImpl service;
    @GetMapping
    public Result getByUsername(String username){
        List list=new ArrayList();
        list.add(service.getByUsername(username));
        return new Result(true,200,"ok",list);
    }
    @DeleteMapping
    public Result deleteUser(Long id){
        return new Result(true,200,"ok",service.deleteUser(id));
    }
    @PutMapping
    public Result updateUser(@RequestBody VideoUser videoUser){
        return new Result(true,200,"ok",service.updateUser(videoUser));
    }
    @PostMapping
    public Result add(@RequestBody VideoUser videoUser){
        return new Result(true,200,"ok",service.add(videoUser));
    }
}